{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "b0ef3cdd",
   "metadata": {},
   "source": [
    "# Conversion to other organisms\n",
    "\n",
    "Most of the prior knowledge stored inside `Omnipath` is derived from human data, therefore they use gene names. Despite this, using homology we can convert gene names to other organisms.\n",
    "\n",
    "To showcase how to do it inside `decoupler`, we will load the `MSigDB` database and convert it into gene symbols for mouse and fly."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f7d87e7d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>genesymbol</th>\n",
       "      <th>collection</th>\n",
       "      <th>geneset</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>MAFF</td>\n",
       "      <td>chemical_and_genetic_perturbations</td>\n",
       "      <td>BOYAULT_LIVER_CANCER_SUBCLASS_G56_DN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>MAFF</td>\n",
       "      <td>chemical_and_genetic_perturbations</td>\n",
       "      <td>ELVIDGE_HYPOXIA_UP</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>MAFF</td>\n",
       "      <td>chemical_and_genetic_perturbations</td>\n",
       "      <td>NUYTTEN_NIPP1_TARGETS_DN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>MAFF</td>\n",
       "      <td>immunesigdb</td>\n",
       "      <td>GSE17721_POLYIC_VS_GARDIQUIMOD_4H_BMDC_DN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>MAFF</td>\n",
       "      <td>chemical_and_genetic_perturbations</td>\n",
       "      <td>SCHAEFFER_PROSTATE_DEVELOPMENT_12HR_UP</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3838543</th>\n",
       "      <td>PRAMEF22</td>\n",
       "      <td>go_biological_process</td>\n",
       "      <td>GOBP_POSITIVE_REGULATION_OF_CELL_POPULATION_PR...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3838544</th>\n",
       "      <td>PRAMEF22</td>\n",
       "      <td>go_biological_process</td>\n",
       "      <td>GOBP_APOPTOTIC_PROCESS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3838545</th>\n",
       "      <td>PRAMEF22</td>\n",
       "      <td>go_biological_process</td>\n",
       "      <td>GOBP_REGULATION_OF_CELL_DEATH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3838546</th>\n",
       "      <td>PRAMEF22</td>\n",
       "      <td>go_biological_process</td>\n",
       "      <td>GOBP_NEGATIVE_REGULATION_OF_DEVELOPMENTAL_PROCESS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3838547</th>\n",
       "      <td>PRAMEF22</td>\n",
       "      <td>go_biological_process</td>\n",
       "      <td>GOBP_NEGATIVE_REGULATION_OF_CELL_DEATH</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>3838548 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        genesymbol                          collection  \\\n",
       "0             MAFF  chemical_and_genetic_perturbations   \n",
       "1             MAFF  chemical_and_genetic_perturbations   \n",
       "2             MAFF  chemical_and_genetic_perturbations   \n",
       "3             MAFF                         immunesigdb   \n",
       "4             MAFF  chemical_and_genetic_perturbations   \n",
       "...            ...                                 ...   \n",
       "3838543   PRAMEF22               go_biological_process   \n",
       "3838544   PRAMEF22               go_biological_process   \n",
       "3838545   PRAMEF22               go_biological_process   \n",
       "3838546   PRAMEF22               go_biological_process   \n",
       "3838547   PRAMEF22               go_biological_process   \n",
       "\n",
       "                                                   geneset  \n",
       "0                     BOYAULT_LIVER_CANCER_SUBCLASS_G56_DN  \n",
       "1                                       ELVIDGE_HYPOXIA_UP  \n",
       "2                                 NUYTTEN_NIPP1_TARGETS_DN  \n",
       "3                GSE17721_POLYIC_VS_GARDIQUIMOD_4H_BMDC_DN  \n",
       "4                   SCHAEFFER_PROSTATE_DEVELOPMENT_12HR_UP  \n",
       "...                                                    ...  \n",
       "3838543  GOBP_POSITIVE_REGULATION_OF_CELL_POPULATION_PR...  \n",
       "3838544                             GOBP_APOPTOTIC_PROCESS  \n",
       "3838545                      GOBP_REGULATION_OF_CELL_DEATH  \n",
       "3838546  GOBP_NEGATIVE_REGULATION_OF_DEVELOPMENTAL_PROCESS  \n",
       "3838547             GOBP_NEGATIVE_REGULATION_OF_CELL_DEATH  \n",
       "\n",
       "[3838548 rows x 3 columns]"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import decoupler as dc\n",
    "\n",
    "msigdb = dc.get_resource('MSigDB')\n",
    "msigdb"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0d101d50",
   "metadata": {},
   "source": [
    "For this example we will filter by the `hallmark` gene sets collection:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "f245fda2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>genesymbol</th>\n",
       "      <th>collection</th>\n",
       "      <th>geneset</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>233</th>\n",
       "      <td>MAFF</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_IL2_STAT5_SIGNALING</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>250</th>\n",
       "      <td>MAFF</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_COAGULATION</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>270</th>\n",
       "      <td>MAFF</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_HYPOXIA</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>373</th>\n",
       "      <td>MAFF</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_TNFA_SIGNALING_VIA_NFKB</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>377</th>\n",
       "      <td>MAFF</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_COMPLEMENT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1449668</th>\n",
       "      <td>STXBP1</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_PANCREAS_BETA_CELLS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1450315</th>\n",
       "      <td>ELP4</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_PANCREAS_BETA_CELLS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1450526</th>\n",
       "      <td>GCG</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_PANCREAS_BETA_CELLS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1450731</th>\n",
       "      <td>PCSK2</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_PANCREAS_BETA_CELLS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1450916</th>\n",
       "      <td>PAX6</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_PANCREAS_BETA_CELLS</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>7318 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        genesymbol collection                           geneset\n",
       "233           MAFF   hallmark      HALLMARK_IL2_STAT5_SIGNALING\n",
       "250           MAFF   hallmark              HALLMARK_COAGULATION\n",
       "270           MAFF   hallmark                  HALLMARK_HYPOXIA\n",
       "373           MAFF   hallmark  HALLMARK_TNFA_SIGNALING_VIA_NFKB\n",
       "377           MAFF   hallmark               HALLMARK_COMPLEMENT\n",
       "...            ...        ...                               ...\n",
       "1449668     STXBP1   hallmark      HALLMARK_PANCREAS_BETA_CELLS\n",
       "1450315       ELP4   hallmark      HALLMARK_PANCREAS_BETA_CELLS\n",
       "1450526        GCG   hallmark      HALLMARK_PANCREAS_BETA_CELLS\n",
       "1450731      PCSK2   hallmark      HALLMARK_PANCREAS_BETA_CELLS\n",
       "1450916       PAX6   hallmark      HALLMARK_PANCREAS_BETA_CELLS\n",
       "\n",
       "[7318 rows x 3 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Filter by hallmark\n",
    "msigdb = msigdb[msigdb['collection']=='hallmark']\n",
    "\n",
    "# Remove duplicated entries\n",
    "msigdb = msigdb[~msigdb.duplicated(['geneset', 'genesymbol'])]\n",
    "msigdb"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f251ac85",
   "metadata": {},
   "source": [
    "Then, we can easily transform the obtained resource into mouse genes. Organisms can be defined by their common name, latin name or [NCBI Taxonomy identifier](https://www.ncbi.nlm.nih.gov/taxonomy).\n",
    "\n",
    "<div class=\"alert alert-info\">\n",
    "\n",
    "**Note**\n",
    "    \n",
    "Translating to an organism for the first time might take a while (~ 15 minutes). Since the data is stored in cache, the next times is going to run faster. If you need to reset the cache, run `rm -r .pypath/cache/`.\n",
    "\n",
    "</div>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "9f5590e8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[2023-06-01 11:17:48] [curl] Module `pysftp` not available. Only downloading of a small number of resources relies on this module. Please install by PIP if it is necessary for you.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>genesymbol</th>\n",
       "      <th>collection</th>\n",
       "      <th>geneset</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Maff</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_IL2_STAT5_SIGNALING</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Maff</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_COAGULATION</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Maff</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_HYPOXIA</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Maff</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_TNFA_SIGNALING_VIA_NFKB</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Maff</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_COMPLEMENT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7683</th>\n",
       "      <td>Stxbp1</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_PANCREAS_BETA_CELLS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7684</th>\n",
       "      <td>Elp4</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_PANCREAS_BETA_CELLS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7685</th>\n",
       "      <td>Gcg</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_PANCREAS_BETA_CELLS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7686</th>\n",
       "      <td>Pcsk2</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_PANCREAS_BETA_CELLS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7687</th>\n",
       "      <td>Pax6</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_PANCREAS_BETA_CELLS</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>7550 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     genesymbol collection                           geneset\n",
       "0          Maff   hallmark      HALLMARK_IL2_STAT5_SIGNALING\n",
       "1          Maff   hallmark              HALLMARK_COAGULATION\n",
       "2          Maff   hallmark                  HALLMARK_HYPOXIA\n",
       "3          Maff   hallmark  HALLMARK_TNFA_SIGNALING_VIA_NFKB\n",
       "4          Maff   hallmark               HALLMARK_COMPLEMENT\n",
       "...         ...        ...                               ...\n",
       "7683     Stxbp1   hallmark      HALLMARK_PANCREAS_BETA_CELLS\n",
       "7684       Elp4   hallmark      HALLMARK_PANCREAS_BETA_CELLS\n",
       "7685        Gcg   hallmark      HALLMARK_PANCREAS_BETA_CELLS\n",
       "7686      Pcsk2   hallmark      HALLMARK_PANCREAS_BETA_CELLS\n",
       "7687       Pax6   hallmark      HALLMARK_PANCREAS_BETA_CELLS\n",
       "\n",
       "[7550 rows x 3 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Translate targets\n",
    "mouse_msigdb = dc.translate_net(msigdb, target_organism = 'mouse', unique_by = ('geneset', 'genesymbol'))\n",
    "mouse_msigdb"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9eba7e39",
   "metadata": {},
   "source": [
    "Note that when performing homology convertion we might gain or lose some genes from one organism to another.\n",
    "\n",
    "Let us try the fruit fly (`7227`) now:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "cb639e96",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>genesymbol</th>\n",
       "      <th>collection</th>\n",
       "      <th>geneset</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Eato</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_TNFA_SIGNALING_VIA_NFKB</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Eato</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_PROTEIN_SECRETION</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Eato</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_ADIPOGENESIS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Eato</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_BILE_ACID_METABOLISM</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Eato</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_INFLAMMATORY_RESPONSE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6594</th>\n",
       "      <td>sut4</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_PANCREAS_BETA_CELLS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6595</th>\n",
       "      <td>G6P</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_PANCREAS_BETA_CELLS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6596</th>\n",
       "      <td>Cbp53E</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_PANCREAS_BETA_CELLS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6598</th>\n",
       "      <td>Rop</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_PANCREAS_BETA_CELLS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6599</th>\n",
       "      <td>amon</td>\n",
       "      <td>hallmark</td>\n",
       "      <td>HALLMARK_PANCREAS_BETA_CELLS</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5866 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     genesymbol collection                           geneset\n",
       "0          Eato   hallmark  HALLMARK_TNFA_SIGNALING_VIA_NFKB\n",
       "1          Eato   hallmark        HALLMARK_PROTEIN_SECRETION\n",
       "2          Eato   hallmark             HALLMARK_ADIPOGENESIS\n",
       "3          Eato   hallmark     HALLMARK_BILE_ACID_METABOLISM\n",
       "4          Eato   hallmark    HALLMARK_INFLAMMATORY_RESPONSE\n",
       "...         ...        ...                               ...\n",
       "6594       sut4   hallmark      HALLMARK_PANCREAS_BETA_CELLS\n",
       "6595        G6P   hallmark      HALLMARK_PANCREAS_BETA_CELLS\n",
       "6596     Cbp53E   hallmark      HALLMARK_PANCREAS_BETA_CELLS\n",
       "6598        Rop   hallmark      HALLMARK_PANCREAS_BETA_CELLS\n",
       "6599       amon   hallmark      HALLMARK_PANCREAS_BETA_CELLS\n",
       "\n",
       "[5866 rows x 3 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Translate targets\n",
    "fly_msigdb = dc.translate_net(msigdb, target_organism = 7227, unique_by = ('genesymbol', 'geneset'))\n",
    "fly_msigdb"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d1b57699",
   "metadata": {},
   "source": [
    "The `translate_net` function provides finer control, but in most cases it's enough to pass the name of the desired organism to the functions that download the data:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "e0aa9113",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>genesymbol</th>\n",
       "      <th>pathway</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Tab2</td>\n",
       "      <td>Toll-like receptor</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Tab2</td>\n",
       "      <td>Innate immune pathways</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Tab2</td>\n",
       "      <td>JAK/STAT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Tab2</td>\n",
       "      <td>Receptor tyrosine kinase</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Map3k7</td>\n",
       "      <td>TNF pathway</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>937</th>\n",
       "      <td>Sit1</td>\n",
       "      <td>T-cell receptor</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>938</th>\n",
       "      <td>Nfatc2</td>\n",
       "      <td>B-cell receptor</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>939</th>\n",
       "      <td>Nfatc2</td>\n",
       "      <td>T-cell receptor</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>940</th>\n",
       "      <td>Rasgrp1</td>\n",
       "      <td>B-cell receptor</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>941</th>\n",
       "      <td>Rasgrp1</td>\n",
       "      <td>T-cell receptor</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>942 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    genesymbol                   pathway\n",
       "0         Tab2        Toll-like receptor\n",
       "1         Tab2    Innate immune pathways\n",
       "2         Tab2                  JAK/STAT\n",
       "3         Tab2  Receptor tyrosine kinase\n",
       "4       Map3k7               TNF pathway\n",
       "..         ...                       ...\n",
       "937       Sit1           T-cell receptor\n",
       "938     Nfatc2           B-cell receptor\n",
       "939     Nfatc2           T-cell receptor\n",
       "940    Rasgrp1           B-cell receptor\n",
       "941    Rasgrp1           T-cell receptor\n",
       "\n",
       "[942 rows x 2 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "spw = dc.get_resource('SignaLink_pathway', organism = 'rat')\n",
    "spw"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ebb64084",
   "metadata": {},
   "source": [
    "PROGENy and CollecTRI have their own dedicated functions which work a similar way:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "6d2cfca1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>source</th>\n",
       "      <th>target</th>\n",
       "      <th>weight</th>\n",
       "      <th>p_value</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Androgen</td>\n",
       "      <td>Tmprss2</td>\n",
       "      <td>11.490631</td>\n",
       "      <td>0.000000e+00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Androgen</td>\n",
       "      <td>Nkx3-1</td>\n",
       "      <td>10.622551</td>\n",
       "      <td>2.242078e-44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>NFkB</td>\n",
       "      <td>Nkx3-1</td>\n",
       "      <td>2.372983</td>\n",
       "      <td>5.589476e-32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>TNFa</td>\n",
       "      <td>Nkx3-1</td>\n",
       "      <td>2.871633</td>\n",
       "      <td>1.044050e-27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Androgen</td>\n",
       "      <td>Mboat2</td>\n",
       "      <td>10.472733</td>\n",
       "      <td>4.624285e-44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1389</th>\n",
       "      <td>p53</td>\n",
       "      <td>Carns1</td>\n",
       "      <td>4.538734</td>\n",
       "      <td>4.730570e-13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1390</th>\n",
       "      <td>p53</td>\n",
       "      <td>Ccdc150</td>\n",
       "      <td>-3.174527</td>\n",
       "      <td>7.396252e-13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1391</th>\n",
       "      <td>p53</td>\n",
       "      <td>Trem2</td>\n",
       "      <td>4.101937</td>\n",
       "      <td>9.739648e-13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1392</th>\n",
       "      <td>p53</td>\n",
       "      <td>Gdf9</td>\n",
       "      <td>3.355741</td>\n",
       "      <td>1.087433e-12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1393</th>\n",
       "      <td>p53</td>\n",
       "      <td>Nhlh2</td>\n",
       "      <td>2.201638</td>\n",
       "      <td>1.651582e-12</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1394 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        source   target     weight       p_value\n",
       "0     Androgen  Tmprss2  11.490631  0.000000e+00\n",
       "1     Androgen   Nkx3-1  10.622551  2.242078e-44\n",
       "2         NFkB   Nkx3-1   2.372983  5.589476e-32\n",
       "3         TNFa   Nkx3-1   2.871633  1.044050e-27\n",
       "4     Androgen   Mboat2  10.472733  4.624285e-44\n",
       "...        ...      ...        ...           ...\n",
       "1389       p53   Carns1   4.538734  4.730570e-13\n",
       "1390       p53  Ccdc150  -3.174527  7.396252e-13\n",
       "1391       p53    Trem2   4.101937  9.739648e-13\n",
       "1392       p53     Gdf9   3.355741  1.087433e-12\n",
       "1393       p53    Nhlh2   2.201638  1.651582e-12\n",
       "\n",
       "[1394 rows x 4 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dc.get_progeny(organism = 'Mus musculus')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "82e8f694",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>source</th>\n",
       "      <th>target</th>\n",
       "      <th>weight</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Myc</td>\n",
       "      <td>Tert</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Spi1</td>\n",
       "      <td>Bglap2</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Spi1</td>\n",
       "      <td>Bglap</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Spi1</td>\n",
       "      <td>Bglap3</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Smad3</td>\n",
       "      <td>Jun</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38660</th>\n",
       "      <td>Runx1</td>\n",
       "      <td>Lcp2</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38661</th>\n",
       "      <td>Runx1</td>\n",
       "      <td>Prr5l</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38662</th>\n",
       "      <td>Twist1</td>\n",
       "      <td>Gli1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38663</th>\n",
       "      <td>Usf1</td>\n",
       "      <td>Nup188</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38664</th>\n",
       "      <td>Znf148</td>\n",
       "      <td>Rnls</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>38665 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       source  target  weight\n",
       "0         Myc    Tert       1\n",
       "1        Spi1  Bglap2       1\n",
       "2        Spi1   Bglap       1\n",
       "3        Spi1  Bglap3       1\n",
       "4       Smad3     Jun       1\n",
       "...       ...     ...     ...\n",
       "38660   Runx1    Lcp2       1\n",
       "38661   Runx1   Prr5l       1\n",
       "38662  Twist1    Gli1       1\n",
       "38663    Usf1  Nup188       1\n",
       "38664  Znf148    Rnls       1\n",
       "\n",
       "[38665 rows x 3 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dc.get_collectri(organism = 'mouse')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "dcp39",
   "language": "python",
   "name": "dcp39"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.15"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
